function dem = demandMM1(in,t,r,type)
% simple seasonal demand function
% r: growth of demand 
%
% revision 06102008
% tobias siegfried

mu = in.muD;
sigma = in.sigmaD;
r = in.dGrowth;
t = in.tEnd;


if nargin < 4
    r = 0; % disp('no growth!');
end

switch type
    case 'sin'
        t = 1:t;
        g = mu + t.*r;
        dem = g + sigma * sin(2*pi*t.years/365);
    case 'transig'
        dem = in.scaleD * repmat(diff(tansig(-5:.1/3.65:5)),1,t.years)';
end